import axiosApi from './AxiosApi.js'

const apiList = {
  page: {
    method: 'GET',
    url: `http://localhost:8185/base/truck/type/page`
  },
  save:{
    method:'POST',
    url:`http://localhost:8185/base/truck/type`
  },

  //查询所有货物类型
  findall:{
    method:'GET',
    url:`http://localhost:8185/base/goodsType/all`
  }

}
export default {
  queryAll (search) {
    return axiosApi({
      ...apiList.page,
      formData: true,
      data:{
        page:search.page,
        pageSize:search.pageSize,
        name:search.name,
        allowableLoad:search.allowableLoad,
        allowableVolume:search.allowableVolume
      },
    })
  },
  update (id,TruckTypeDto) {
    return axiosApi({
      method:'PUT',
      url:`http://localhost:8185/base/truck/type/${id}`,
      data:TruckTypeDto
    })
  },
  save (TruckTypeDto) {
    return axiosApi({
      ...apiList.save,
      data:TruckTypeDto
    })
  },
  delete (id) {
    return axiosApi({
      url:`http://localhost:8185/base/truck/type/${id}/disable`,
      method:'PUT'
    })
  },
  findall(){
    return axiosApi({
      ...apiList.findall,
      formData:true
    })
  }

}
